#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h> 
#include <stdlib.h>
#include <assert.h>
#include "app_platform/cntl_info.h"
#include "storagedao.h"


#include "c2cplatform/component/dal/dal_set.h"
#include "c2cent/storage/mysqlstorage.h"
#include "c2cplatform/component/dal/db_operator_mysql_set.h"

#include "c2cplatform/library/string/string_helper.h"

using namespace c2cplatform::component::dal;
using namespace c2cplatform::library::string;
using namespace c2cent::storage;

using namespace erp::storage::dao;

CPP_SELF_DEFINE_START
/**
*  请在这里增加自定义的成员变量和函数及其他内容，否则无法合并代码
**/
#include "storagedao_enum.h"
#include "erp/comm/erp_macro_define.h"
#include "erp/comm/erp_errno_define.h"
#include "c2cent/dao/idmaker/idmakerdao_stub4web_allinone.h"

using namespace c2cent::library::wtimeelf;
using namespace c2cent::library::wwlog;
using namespace erp::comm;
using namespace c2cent::dao::idmaker;


#define DB_ROLE_NAME_Stock	                "erp_yun_storage"
#define TABLE_NAME_Stock                    "T_Stock_"

CPP_SELF_DEFINE_END

/**
 *构建函数
 */
CStorageDao::CStorageDao(enum DeployMethod method)
{
}

/**
 *析构函数
 */
CStorageDao::~CStorageDao()
{
}


/**
 *每一次服务请求时，container都会调用此方法来清空数据
 */
void  CStorageDao::Reset()
{
}


int  CStorageDao::Initialize(IUserDefineCntl* pCntl)
{
	int iRet = 0;
	uint32_t dwLogSwitch=WLOG_OPEN|WLOG_KEY_OPEN|WLOG_ERR_OPEN;
	uint32_t dwCanLogRemote = 0;
	std::string strLogModule="dao_storage";

	std::cout<<"File:"<<__FILE__<<" Complie Date: "<<__DATE__<<" "<<__TIME__<<std::endl;

	 if(CDAL_SET->Initialize() != 0)
	 {
		 printf("CDAL_SET Init Failed, %s\n", CDAL_SET->getLastErrMsg());
		 return -1;
	 }

	 GetUintConfig(LogSwitch);
	 GetStringConfig(LogModule);
	 GetUintConfig(CanLogRemote);

	 // 初始化日志
	 if( C2C_WWLOG->QuickInitForAPP2(strLogModule.c_str(),B2B2CWW_LOG_APP_FILE_PATH, dwCanLogRemote, dwLogSwitch)!= 0)
	  {
		 std::cerr << "C2C_WWLOG->QuickInitForAPP2 Failed" << std::endl;
		 return -1;
	  }
	 C2C_WW_LOG("C2C_WWLOG->QuickInitForAPP2 OK!");
	return iRet;
}


/**
 *
 *  写入仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param StockDdo StockInfo: 仓库信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param uint64_t StockSysNo: 返回添加成功的SysNo  	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::AddStock(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::ddo::CStockDdo& oStockInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				uint64_t& ddwStockSysNo
	)
{
	    int32_t iRetCode = 0;

		uint16_t iSetId=0;
		uint32_t  m_dwOperatorUin = rCntlInfo.getOperatorUin();
		uint64_t ddwEmployeeId =  rCntlInfo.getOperatorUid();	//职员登录账户
		uint32_t DB_Stock_Code =  rCntlInfo.getOperatorUin(); //表ID


	    C2C_WW_LOG("GetAReq %s OpUin:%u MachineKey:%s Source:%s SceneId:%u EmployeeId:%lu", __FUNCTION__,
	                    m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId,ddwEmployeeId);
		C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode);

	    c2cent::storage::CMySqlStorage oStorage(CDAL_SET->GetDBOperator(rCntlInfo.getCmdId(),
	    		                                DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock,iSetId, true));




		if (oStockInfo.GetStockSysNo() == 0)
		{
			//获取idmaker服务提供的sysno
			//这是我们刚申请的业务号     申请单号 :201310300006
			uint32_t BizType = 233;
			//我们打算要申请的数量
			uint32_t ReqSize = 1;
			//服务实际返回给我们的数量
			uint32_t RespSize = 0;
			//服务返回给我们的id的起始值,这个0是我自己写的默认值,你也可以自己写啦
			uint64_t sysNo = 0;
			c2cent::dao::idmaker::CIdMakerDaoStub4Web sysNoMaker;
			//这句话调用了idmaker服务.并返回一个我们需要的sysNo
			uint32_t idmakerResult = sysNoMaker.GetNeedIdsForU64(rCntlInfo, BizType,
							ReqSize, RespSize, sysNo);

			if (idmakerResult != 0 || sysNo == 0)
			{
				C2C_WW_LOG_ERR(ERR_ERP_YUN_MAKEID_FAILED, "Get make id failed, OpUin:%u MachineKey:%s Source:%s SceneId:%u, Result:%u, SysNo:%ld",
									rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId, idmakerResult, sysNo);
				return ERR_ERP_YUN_MAKEID_FAILED;
			}

			ddwStockSysNo = sysNo;
		}
		else
		{
			ddwStockSysNo = oStockInfo.GetStockSysNo();
		}


	    std::stringstream sql;
	    sql << " INSERT INTO ";
	    sql << " " << CDAL_SET->GetTableName(iSetId,DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock).c_str();
	    sql << " (FStockSysNo,FContactSysNo,FStockID,FFullName,FName,FPyCode,";
	    sql << " FStockProperty,FStockStatus,FCreatorSysNo,FModifierSysNo,FRowCreatDate,FRowModifyDate) VALUES( ";
	    sql << " " << ddwStockSysNo << ", ";
	    sql << " " << oStockInfo.GetContactSysNo() << ", ";
	    sql << " '" << oStorage.EscapeString(oStockInfo.GetStockID()) << "', ";
	    sql << " '" << oStorage.EscapeString(oStockInfo.GetFullName()) << "', ";
	    sql << " '" << oStorage.EscapeString(oStockInfo.GetName()) << "', ";
	    sql << " '" << oStorage.EscapeString(oStockInfo.GetPyCode()) << "', ";
	    sql << " " << oStockInfo.GetStockProperty() << ", ";
	    sql << " " << oStockInfo.GetStockStatus() << ", ";
	    sql << " " << oStockInfo.GetCreatorSysNo() << ", ";
	    sql << " " << oStockInfo.GetModifierSysNo() << ", ";
	    sql << " now(), now() ";
		sql << " ) ";

		C2C_WW_LOG_DEBUG("sql:%s", sql.str().c_str());//debug

		iRetCode = oStorage.Update(sql.str());

		if(iRetCode!=0)
		{//错误日志
			C2C_WW_LOG_ERR(iRetCode, "ExeSql Failed, Sql:%s", sql.str().c_str());
			C2C_WW_LOG_ERR(ERR_STORAGE_ADD_FAIL, "ExeSql Failed, OpUin:%u MachineKey:%s Source:%s SceneId:%u EmployeeId:%lu",
							rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId, ddwEmployeeId);
			return ERR_STORAGE_ADD_FAIL;
		}

		//操作没有操作到任何一条数据
		if(oStorage.GetAffectedRows()==0)
		{
			//错误日志
			C2C_WW_LOG_ERR(ERR_STORAGE_AFFECT_NONE, "ExeSql Update None, Sql:%s", sql.str().c_str());
			C2C_WW_LOG_ERR(ERR_STORAGE_AFFECT_NONE, "ExeSql Failed, OpUin:%u MachineKey:%s Source:%s SceneId:%u EmployeeId:%lu",
								rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId, ddwEmployeeId);
			return ERR_STORAGE_AFFECT_NONE;
		}

		/*oEmployeeBack.SetEmployeeId(oEmployee.GetEmployeeId());
		oEmployeeBack.SetEmployeeName(oEmployee.GetEmployeeName());
		oEmployeeBack.SetEmployeeEnglishName(oEmployee.GetEmployeeEnglishName());*/

	return iRetCode;
}

/**
 *
 *  逻辑删除仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param Set FStockSysNo: 需删除的仓库ID，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map errorCode: 删除失败的错误码 	[out]
 *@param Map errorMsg: 删除失败的错误信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::DeleteStock(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const std::set<uint64_t >& setFStockSysNo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::map<uint64_t,uint32_t >& mapErrorCode,
				std::map<uint64_t,std::string >& mapErrorMsg,
				std::string& strOutReserve
	)
{
	int32_t iRetCode = 0;

	uint16_t iSetId=0;
	uint32_t  m_dwOperatorUin = rCntlInfo.getOperatorUin();
	uint64_t ddwEmployeeId =  rCntlInfo.getOperatorUid();	//职员登录账户
	uint32_t DB_Stock_Code =  rCntlInfo.getOperatorUin(); //表ID



    C2C_WW_LOG("GetAReq %s OpUin:%u MachineKey:%s Source:%s SceneId:%u EmployeeId:%lu", __FUNCTION__,
                    m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId,ddwEmployeeId);
	C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode);


    c2cent::storage::CMySqlStorage oStorage(CDAL_SET->GetDBOperator(rCntlInfo.getCmdId(),
    		                                DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock,iSetId, true));


    if(setFStockSysNo.size() == 0)
    {
    	return ERR_STORAGE_AFFECT_NONE;
    }

    std::stringstream sql;
    sql << " UPDATE  ";
    sql << " " << CDAL_SET->GetTableName(iSetId,DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock).c_str();
    sql << " SET  FStockStatus = 0" << ", ";
    sql << " FModifierSysNo =" << ddwEmployeeId << ", ";
    sql << " FRowModifyDate = now()";

    uint32_t dwSize = setFStockSysNo.size();
    if(dwSize > 0)
    {
    	std::stringstream sysNos;
		for(std::set<uint64_t>::const_iterator it = setFStockSysNo.begin();it != setFStockSysNo.end();it++){
			 sysNos << *it << ",";
		}
		sql << " WHERE FStockSysNo IN (" << Trim(sysNos.str(), ',') << ")";//2为标记删除状态，需要过滤
    }


	C2C_WW_LOG_DEBUG("sql:%s", sql.str().c_str());//debug

	iRetCode = oStorage.Update(sql.str());


	//操作没有操作到任何一条数据
	if(oStorage.GetAffectedRows()==0)
	{
		//错误日志
		C2C_WW_LOG_ERR(ERR_STORAGE_AFFECT_NONE, "ExeSql Update None, Sql:%s", sql.str().c_str());
		C2C_WW_LOG_ERR(ERR_STORAGE_AFFECT_NONE, "ExeSql Failed, OpUin:%u MachineKey:%s Source:%s SceneId:%u EmployeeId:%lu",
							rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId, ddwEmployeeId);
		return ERR_STORAGE_AFFECT_NONE;
	}

	/*oEmployeeBack.SetEmployeeId(oEmployee.GetEmployeeId());
	oEmployeeBack.SetEmployeeName(oEmployee.GetEmployeeName());
	oEmployeeBack.SetEmployeeEnglishName(oEmployee.GetEmployeeEnglishName());*/

  return iRetCode;
}

/**
 *
 *  修改仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param StockDdo StockInfo: 仓库信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::UpdateStock(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::ddo::CStockDdo& oStockInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	int32_t iRetCode = 0;

	uint16_t iSetId=0;
	uint32_t  m_dwOperatorUin = rCntlInfo.getOperatorUin();
	uint64_t ddwEmployeeId =  rCntlInfo.getOperatorUid();	//职员登录账户
	uint32_t DB_Stock_Code =  rCntlInfo.getOperatorUin(); //表ID


    C2C_WW_LOG("GetAReq %s OpUin:%u MachineKey:%s Source:%s SceneId:%u EmployeeId:%lu", __FUNCTION__,
                    m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId,ddwEmployeeId);
	C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode);


    c2cent::storage::CMySqlStorage oStorage(CDAL_SET->GetDBOperator(rCntlInfo.getCmdId(),
    		                                DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock,iSetId, true));

    if(oStockInfo.ddwStockSysNo == 0)
    {
    	return ERR_STORAGE_AFFECT_NONE;
    }

    std::stringstream sql;
    sql << " UPDATE  ";
    sql << " " << CDAL_SET->GetTableName(iSetId,DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock).c_str() << " SET ";

	if(oStockInfo.IsContactSysNoSet())
	{
       sql << "FContactSysNo = " << oStockInfo.GetContactSysNo() << ", ";
	}
	if(oStockInfo.IsStockIDSet())
	{
       sql << "FStockID = '" << oStorage.EscapeString(oStockInfo.GetStockID()) << "', ";
	}
	if(oStockInfo.IsFullNameSet())
	{
       sql << "FFullName = '" << oStorage.EscapeString(oStockInfo.GetFullName()) << "', ";
	}
	if(oStockInfo.IsNameSet())
	{
       sql << "FName = '" << oStorage.EscapeString(oStockInfo.GetName()) << "', ";
	}
	if(oStockInfo.IsPyCodeSet())
	{
       sql << "FPyCode = '" << oStorage.EscapeString(oStockInfo.GetPyCode()) << "', ";
	}
	if(oStockInfo.IsStockPropertySet())
	{
       sql << "FStockProperty = " << oStockInfo.GetStockProperty() << ", ";
	}
	if(oStockInfo.IsStockStatusSet())
	{
       sql << "FStockStatus = " << oStockInfo.GetStockStatus() << ", ";
	}
	if(oStockInfo.IsModifierSysNoSet())
	{
       sql << "FModifierSysNo =" << oStockInfo.GetModifierSysNo() << ", ";
	}

    sql << "FRowModifyDate = now()";

    if(oStockInfo.IsStockIDSet()){
    		sql<<"where FStockSysNo ="<<oStockInfo.GetStockSysNo();
    }

	C2C_WW_LOG_DEBUG("sql:%s", sql.str().c_str());//debug

	iRetCode = oStorage.Update(sql.str());


	//操作没有操作到任何一条数据
	if(oStorage.GetAffectedRows()==0)
	{
		//错误日志
		C2C_WW_LOG_ERR(ERR_STORAGE_AFFECT_NONE, "ExeSql Update None, Sql:%s", sql.str().c_str());
		C2C_WW_LOG_ERR(ERR_STORAGE_AFFECT_NONE, "ExeSql Failed, OpUin:%u MachineKey:%s Source:%s SceneId:%u EmployeeId:%lu",
							rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId, ddwEmployeeId);
		return ERR_STORAGE_AFFECT_NONE;
	}

	/*oEmployeeBack.SetEmployeeId(oEmployee.GetEmployeeId());
	oEmployeeBack.SetEmployeeName(oEmployee.GetEmployeeName());
	oEmployeeBack.SetEmployeeEnglishName(oEmployee.GetEmployeeEnglishName());*/

  return iRetCode;

}

/**
 *
 *  根据ID获取仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set StockSysnoList: 需获取的仓库ID，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector StockList: 仓库列表信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetStockBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const std::set<uint64_t >& setStockSysnoList,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::vector<erp::storage::ddo::CStockDdo >& vecStockList,
				std::string& strOutReserve
	)
{
	    int32_t iRetCode = 0;

		uint16_t iSetId=0;
		uint32_t  m_dwOperatorUin = rCntlInfo.getOperatorUin();
		uint64_t ddwEmployeeId =  rCntlInfo.getOperatorUid();	//职员登录账户
		uint32_t DB_Stock_Code =  rCntlInfo.getOperatorUin(); //表ID

	    C2C_WW_LOG("GetStockByIds %s OpUin:%u MachineKey:%s Source:%s SceneId:%u", __FUNCTION__,
	                    m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId);

	    //打印性能日志的同时进行接口的itil上报
	    C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode);

	    c2cent::storage::CMySqlStorage oStorage(CDAL_SET->GetDBOperator(rCntlInfo.getCmdId(),
	    		                                DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock,iSetId, true));


		std::stringstream sysNos;

		for (std::set<uint64_t>::iterator it = setStockSysnoList.begin(); it != setStockSysnoList.end(); it++)
		{
			sysNos << *it << ",";
		}

	    std::stringstream sql;


	    sql<<"select FStockSysNo,FContactSysNo,FStockID,FFullName,FName,FPyCode,";
	    sql<<" FStockProperty,FStockStatus,FCreatorSysNo,FModifierSysNo,FRowCreatDate,FRowModifyDate from";
	    sql << " " << CDAL_SET->GetTableName(iSetId,DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock).c_str();
	    sql << " WHERE FStockSysNo IN (" << Trim(sysNos.str(), ',') << ")";//2为标记删除状态，需要过滤


	    C2C_WW_LOG_DEBUG("sql:%s", sql.str().c_str());


	    IResultSet& oRs = oStorage.QueryForResultSet(sql.str());


	     if(!oRs.IsReady()) //db操作错误
	     {
	    	oRs.Close();
	    	C2C_WW_LOG_ERR(ERR_STORAGE_GET_FAIL, "ExeSql Failed, Sql:%s", sql.str().c_str());
	        C2C_WW_LOG_ERR(ERR_STORAGE_GET_FAIL, "ExeSql Failed, OpUin:%u MachineKey:%s Source:%s SceneId:%u",
	                            rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId);
	        return ERR_STORAGE_GET_FAIL;
	      }

	      if(!oRs.First() || oRs.GetRecordCount() == 0) //无记录
	      {
	    	  oRs.Close();
	          C2C_WW_LOG_ERR(ERR_STORAGE_GET_NONE, "ExeSql Failed, Sql:%s", sql.str().c_str());
	          C2C_WW_LOG_ERR(ERR_STORAGE_GET_NONE, "QuerySql not exist, "
	                            "OpUin:%u MachineKey:%s Source:%s SceneId:%u",
	                            rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId);
	          return ERR_STORAGE_GET_NONE;
	      }

	      do{
	    	  erp::storage::ddo::CStockDdo oStockDdo;
	    	  oStockDdo.SetStockSysNo((uint64_t)oRs.GetBigInt("FStockSysNo"));
	    	  oStockDdo.SetContactSysNo((uint64_t)oRs.GetBigInt("FContactSysNos"));
	    	  oStockDdo.SetStockID(oRs.GetString("FStockID")?oRs.GetString("FStockID"):"");
	    	  oStockDdo.SetFullName(oRs.GetString("FFullName")?oRs.GetString("FFullName"):"");
	    	  oStockDdo.SetName(oRs.GetString("FName")?oRs.GetString("FName"):"");
	    	  oStockDdo.SetPyCode(oRs.GetString("FPyCode")?oRs.GetString("FPyCode"):"");
	    	  oStockDdo.SetStockStatus((uint32_t)oRs.GetUInt("FStockStatus"));
	    	  oStockDdo.SetCreatorSysNo((uint64_t)oRs.GetBigInt("CreatorSysNo"));
	    	  oStockDdo.SetRowCreatDate((uint32_t)oRs.GetUInt("RowCreatDate"));
	    	  oStockDdo.SetModifierSysNo((uint64_t)oRs.GetBigInt("ModifierSysNo"));
	    	  oStockDdo.SetRowModifyDate((uint32_t)oRs.GetUInt("ModifyDate"));

	    	  vecStockList.push_back(oStockDdo);
	        }while(oRs.Next());
	        oRs.Close();

	    return iRetCode;
}

/**
 *
 *  根据filter获取仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param StockFilterDdo StockFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint32_t total: 仓库总数 	[out]
 *@param Vector StockList: 仓库列表信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetStockList(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const erp::storage::ddo::CStockFilterDdo& oStockFilter,
				const std::string& strInReserve,
				std::string& strErrmsg,
				uint32_t& dwTotal,
				std::vector<erp::storage::ddo::CStockDdo >& vecStockList,
				std::string& strOutReserve
	)
{
	int32_t iRetCode = 0;

	uint16_t iSetId=0;
	uint32_t  m_dwOperatorUin = rCntlInfo.getOperatorUin();
	uint64_t ddwEmployeeId =  rCntlInfo.getOperatorUid();	//职员登录账户
	uint32_t DB_Stock_Code =  rCntlInfo.getOperatorUin(); //表ID

    C2C_WW_LOG("GetStockList %s OpUin:%u MachineKey:%s Source:%s SceneId:%u", __FUNCTION__,
                    m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId);
    //打印性能日志的同时进行接口的itil上报
    C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode);

    c2cent::storage::CMySqlStorage oStorage(CDAL_SET->GetDBOperator(rCntlInfo.getCmdId(),
    		                                DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock,iSetId, true));
    std::stringstream sql;


    sql<<"select FStockSysNo,FContactSysNo,FStockID,FFullName,FName,FPyCode,";
    sql<<" FStockProperty,FStockStatus,FCreatorSysNo,FModifierSysNo,FRowCreatDate,FRowModifyDate from";
    sql << " " << CDAL_SET->GetTableName(iSetId,DB_Stock_Code, DB_ROLE_NAME_Stock, TABLE_NAME_Stock).c_str();

    sql<<" where 1=1";


    //此处 没有判断 是否为空 IsFStockIDSet（没起作用）
	if(oStockFilter.IsStockStatusSet()){
		sql<<" and FStockStatus ="<<oStockFilter.GetStockStatus();
	}



	sql<<" limit "<<(oStockFilter.GetPage()-1)*oStockFilter.GetPageSize()<<","<<oStockFilter.GetPageSize();


	 C2C_WW_LOG_DEBUG("sql:%s", sql.str().c_str());

    IResultSet& oRs = oStorage.QueryForResultSet(sql.str());




    if(!oRs.IsReady()) //db操作错误
     {
    	oRs.Close();
    	C2C_WW_LOG_ERR(ERR_STORAGE_GET_FAIL, "ExeSql Failed, Sql:%s", sql.str().c_str());
        C2C_WW_LOG_ERR(ERR_STORAGE_GET_FAIL, "ExeSql Failed, OpUin:%u MachineKey:%s Source:%s SceneId:%u",
                            rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId);
        return ERR_STORAGE_GET_FAIL;
      }

      if(!oRs.First() || oRs.GetRecordCount() == 0) //无记录
      {
    	  oRs.Close();
          C2C_WW_LOG_ERR(ERR_STORAGE_GET_NONE, "ExeSql Failed, Sql:%s", sql.str().c_str());
          C2C_WW_LOG_ERR(ERR_STORAGE_GET_NONE, "QuerySql not exist, "
                            "OpUin:%u MachineKey:%s Source:%s SceneId:%u",
                            rCntlInfo.getOperatorUin(), strMachineKey.c_str(), strSource.c_str(), dwSceneId);
          return ERR_STORAGE_GET_NONE;
      }

      do{
    	  erp::storage::ddo::CStockDdo oStockDdo;
    	  oStockDdo.SetStockSysNo((uint64_t)oRs.GetBigInt("FStockSysNo"));
    	  oStockDdo.SetContactSysNo((uint64_t)oRs.GetBigInt("FContactSysNos"));
    	  oStockDdo.SetStockID(oRs.GetString("FStockID")?oRs.GetString("FStockID"):"");
    	  oStockDdo.SetFullName(oRs.GetString("FFullName")?oRs.GetString("FFullName"):"");
    	  oStockDdo.SetName(oRs.GetString("FName")?oRs.GetString("FName"):"");
    	  oStockDdo.SetPyCode(oRs.GetString("FPyCode")?oRs.GetString("FPyCode"):"");
    	  oStockDdo.SetStockStatus((uint32_t)oRs.GetUInt("FStockStatus"));
    	  oStockDdo.SetCreatorSysNo((uint64_t)oRs.GetBigInt("CreatorSysNo"));
    	  oStockDdo.SetRowCreatDate((uint32_t)oRs.GetUInt("RowCreatDate"));
    	  oStockDdo.SetModifierSysNo((uint64_t)oRs.GetBigInt("ModifierSysNo"));
    	  oStockDdo.SetRowModifyDate((uint32_t)oRs.GetUInt("ModifyDate"));

    	  vecStockList.push_back(oStockDdo);
        }while(oRs.Next());
        oRs.Close();

    return iRetCode;
}


/**
 *
 *  维护仓库与分支机构关系
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param uint64_t StockSysNo: 仓库sys，必填   [in]
 *@param Set BranchSysNos: 仓库sys，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::ModifyStockBranch_Rel(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				uint64_t ddwStockSysNo,
				const std::set<uint64_t >& setBranchSysNos,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  查询仓库与分支机构关系
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param uint64_t StockSysNo: 仓库sys，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param Vector StockBranchList: 仓库与分支机构关系列表信息 	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetStockBranch_RelBySysNo(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				uint64_t ddwStockSysNo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				std::vector<erp::storage::ddo::CStockBranch_RelDdo >& vecStockBranchList
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  写入报损/报溢表
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param LoseBillDdo LoseBillInfo: 报损表信息，必填   [in]
 *@param OverFlowBillDdo OverFlowBillInfo: 报溢表信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param uint64_t OverFlowBillSysNo: 返回添加成功的SysNo  	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::AddLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::ddo::CLoseBillDdo& oLoseBillInfo,
				const erp::storage::ddo::COverFlowBillDdo& oOverFlowBillInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				uint64_t& ddwOverFlowBillSysNo
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  逻辑删除报损/报溢表
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param Set FLoseBillSysNo: 需删除的报损ID，必填   [in]
 *@param Set FOverFlowBillSysNo: 需删除的报溢ID，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map errorCode: 删除失败的错误码 	[out]
 *@param Map errorMsg: 删除失败的错误信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::DeleteLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const std::set<uint64_t >& setFLoseBillSysNo,
				const std::set<uint64_t >& setFOverFlowBillSysNo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::map<uint64_t,uint32_t >& mapErrorCode,
				std::map<uint64_t,std::string >& mapErrorMsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  修改报损/报溢表
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param LoseBillDdo LoseBillInfo: 报损表信息，必填   [in]
 *@param OverFlowBillDdo OverFlowBillInfo: 报溢表信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::UpdataLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::ddo::CLoseBillDdo& oLoseBillInfo,
				const erp::storage::ddo::COverFlowBillDdo& oOverFlowBillInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  根据ID获取报损/报溢表信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set LoseBillSysNoList: 需获取的仓库sysnos，必填   [in]
 *@param Set OverFlowSysNoList: 需获取的仓库sysnos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector LoseBillList: 报损列表信息 	[out]
 *@param Vector OverFlowList: 报溢列表信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetLoseBillOrOverFlowBillBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const std::set<uint64_t >& setLoseBillSysNoList,
				const std::set<uint64_t >& setOverFlowSysNoList,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::vector<erp::storage::ddo::CLoseBillDdo >& vecLoseBillList,
				std::vector<erp::storage::ddo::COverFlowBillDdo >& vecOverFlowList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  根据filter获取报损/报溢表
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param OverFlowBillOrLoseBillFilterDdo OverFlowBillOrLoseBillFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint32_t total: 信息总数 	[out]
 *@param Vector LoseBillList: 报损列表信息 	[out]
 *@param Vector OverFlowList: 报溢列表信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetLoseBillOrOverFlowBillList(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const erp::storage::ddo::COverFlowBillOrLoseBillFilterDdo& oOverFlowBillOrLoseBillFilter,
				const std::string& strInReserve,
				std::string& strErrmsg,
				uint32_t& dwTotal,
				std::vector<erp::storage::ddo::CLoseBillDdo >& vecLoseBillList,
				std::vector<erp::storage::ddo::COverFlowBillDdo >& vecOverFlowList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单创建
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param DisassembleBillDdo DisassembleBillInfo: 拆装单信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param uint64_t DisassembleBillSysNo: 返回添加成功的SysNo  	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::AddDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::ddo::CDisassembleBillDdo& oDisassembleBillInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				uint64_t& ddwDisassembleBillSysNo
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单删除（逻辑）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param Set DisassemblebillSysNos: 需删除的拆装单SysNos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map errorCode: 删除失败的错误码 	[out]
 *@param Map errorMsg: 删除失败的错误信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::DeleteDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const std::set<uint64_t >& setDisassemblebillSysNos,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::map<uint64_t,uint32_t >& mapErrorCode,
				std::map<uint64_t,std::string >& mapErrorMsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单修改
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param DisassembleBillDdo DisassembleBillInfo: 拆装单信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::UpdataDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::ddo::CDisassembleBillDdo& oDisassembleBillInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单查询（主键）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set DisassembleBillSysnoList: 需获取的仓库sysnos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector DisassembleBillList: 拆装单信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetDisassembleBillBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const std::set<uint64_t >& setDisassembleBillSysnoList,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::vector<erp::storage::ddo::CDisassembleBillDdo >& vecDisassembleBillList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单列表（列表过滤）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param DisassembleBillFilterDdo DisassembleBillFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint32_t total: 信息总数 	[out]
 *@param Vector DisassembleBillList: 拆装单信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetDisassembleBillList(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const erp::storage::ddo::CDisassembleBillFilterDdo& oDisassembleBillFilter,
				const std::string& strInReserve,
				std::string& strErrmsg,
				uint32_t& dwTotal,
				std::vector<erp::storage::ddo::CDisassembleBillDdo >& vecDisassembleBillList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  盘点单创建
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param StockCheckMasterDdo StockCheckMasterInfo: 盘点单信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param uint64_t StockCheckMasterSysNo: 返回添加成功的SysNo  	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::AddStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::ddo::CStockCheckMasterDdo& oStockCheckMasterInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				uint64_t& ddwStockCheckMasterSysNo
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  盘点单删除（逻辑）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param Set StockCheckMasterSysNos: 需删除的拆装单SysNos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map errorCode: 删除失败的错误码 	[out]
 *@param Map errorMsg: 删除失败的错误信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::DeleteStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const std::set<uint64_t >& setStockCheckMasterSysNos,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::map<uint64_t,uint32_t >& mapErrorCode,
				std::map<uint64_t,std::string >& mapErrorMsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  盘点单修改
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param StockCheckMasterDdo StockCheckMasterInfo: 盘点单信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::UpdataStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::ddo::CStockCheckMasterDdo& oStockCheckMasterInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  盘点单查询（主键）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set StockCheckMasterSysNoList: 需获取的仓库sysnos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector StockCheckList: 盘点单信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetStockCheckBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const std::set<uint64_t >& setStockCheckMasterSysNoList,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::vector<erp::storage::ddo::CStockCheckMasterDdo >& vecStockCheckList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 * 盘点单列表（列表过滤）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param StockCheckFilterDdo StockCheckFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint32_t total: 信息总数 	[out]
 *@param Vector StockCheckList: 盘点单信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageDao::GetStockCheckList(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const erp::storage::ddo::CStockCheckFilterDdo& oStockCheckFilter,
				const std::string& strInReserve,
				std::string& strErrmsg,
				uint32_t& dwTotal,
				std::vector<erp::storage::ddo::CStockCheckMasterDdo >& vecStockCheckList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}
